package day_2022_7_to_8.day48;

/**
 * @author haomin
 * @date 2022/08/30 09:57
 **/
public class Day45_1_Num998_InsertIntoMaxTree {
    class Solution {
        public TreeNode insertIntoMaxTree(TreeNode root, int val) {
            if(root == null) return new TreeNode(val);
            if(root.val < val){
                TreeNode head = new TreeNode(val);
                head.left = root;
                return head;
            }else {
                root.right = insertIntoMaxTree(root.right, val);
                return root;
            }
        }
    }
}